package com.company.dcm.server.protocol.enums;

import lombok.Getter;

/**
 * @Author: 王泽同
 * @Description:
 */
@Getter
public enum ProtocolMessageTypeEnum{
    INFORMATION("information",1),
    BIG_DATA("bigData", 2),
    OTA("ota", 3),
    DATA_PASSTHROUGH_PACKET("dataPassthroughPacket",4);

    private final String text;
    private final int value;

    ProtocolMessageTypeEnum(String text,int value){
        this.text = text;
        this.value = value;
    }

    /**
     * 根据value获取枚举值
     * @param value
     * @return
     */
    public static ProtocolMessageTypeEnum getEnumByValue(int value){
        for (ProtocolMessageTypeEnum anEnum : ProtocolMessageTypeEnum.values())
            if (anEnum.value == value){
                return anEnum;
            }
        return null;
    }
}

